package test2_annonation.aop;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;


@Component
//设置当前类是切面类
@Aspect
public class MyAdvice {

    //切入点，要执行切入的方法
    @Pointcut("execution(void test2_annonation.impl.BookSerivce2Impl.save())")
    private void pt_service(){}


    @Around("pt_service()")
    public void method(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("begin:"+System.currentTimeMillis());
        pjp.proceed();
        System.out.println("end:"+System.currentTimeMillis());
    }

}
